<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<style id=style_element>
div {
  perspective: 10;
  transform: perspective(10);
}
</style>
<script>
// From UseCounter.h
var UnitlessPerspectiveInPerspectiveProperty = 1671;
var UnitlessPerspectiveInTransformProperty = 1672;

test(function() {
    assert_equals(document.styleSheets[0].cssRules[0].style.cssText, "");
    assert_false(internals.isUseCounted(document, UnitlessPerspectiveInPerspectiveProperty));
    assert_false(internals.isUseCounted(document, UnitlessPerspectiveInTransformProperty));
}, "Unitless lengths don't work in unprefixed perspective/transform");

test(function() {
    style_element.textContent = "div { -webkit-perspective: 10; }";
    assert_equals(document.styleSheets[0].cssRules[0].style.cssText, "perspective: 10px;");
    assert_true(internals.isUseCounted(document, UnitlessPerspectiveInPerspectiveProperty));
    assert_false(internals.isUseCounted(document, UnitlessPerspectiveInTransformProperty));

    style_element.textContent = "div { -webkit-transform: perspective(10); }";
    assert_equals(document.styleSheets[0].cssRules[0].style.cssText, "transform: perspective(10px);");
    assert_true(internals.isUseCounted(document, UnitlessPerspectiveInTransformProperty));
}, "Unitless lengths work in prefixed perspective/transform and are counted");
</script>
